A variety of tools and techniques are used for computer program analysis. Partially or fully automated program analysis may assist in program optimization, program verification, program implementation (initial creation and/or subsequent modification), program defect detection, program porting, and other efforts. A given approach may examine and/or utilize type systems, source code annotations, model checking, architecture diagrams, performance profiles, instrumentation, program slicing, inheritance/dependency graphs, and/or other tools and techniques while analyzing the behavior of computer programs.
Two differing approaches taken in program analysis are dynamic program analysis and static program analysis. Dynamic program analysis is performed by executing programs on real and/or virtual processor(s). Test inputs may be selected in an effort to produce interesting program behavior for dynamic analysis; input from a live production server may also be used in some cases. Techniques such as code coverage may help ensure that a representative sample of the tested program's possible behaviors is obtained. However, instrumentation used to obtain dynamic test data may alter the execution speed and/or other characteristics of the tested program. Static code analysis is performed without executing the program that is being analyzed. Static analysis may be performed on source code, on intermediate or other object code, or on both. The depth and breadth of static analysis varies, from analyses that only consider individual statements and declarations, to analyses that consider the complete source code of a program, for example.